package com.sanqi.work.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sanqi.common.annotation.Log;
import com.sanqi.common.core.controller.BaseController;
import com.sanqi.common.core.domain.AjaxResult;
import com.sanqi.common.enums.BusinessType;
import com.sanqi.work.domain.WxTmpDayWork;
import com.sanqi.work.service.IWxTmpDayWorkService;
import com.sanqi.common.utils.poi.ExcelUtil;
import com.sanqi.common.core.page.TableDataInfo;

/**
 * 个人当天数据Controller
 * 
 * @author duany
 * @date 2025-10-14
 */
@RestController
@RequestMapping("/dayWork/work")
@Api(tags="个人当天数据")
public class WxTmpDayWorkController extends BaseController
{
    @Autowired
    private IWxTmpDayWorkService wxTmpDayWorkService;

    /**
     * 查询个人当天数据列表
     */
    @PreAuthorize("@ss.hasPermi('dayWork:work:list')")
    @GetMapping("/list")
    @ApiOperation(value="个人当天数据-查询个人当天数据列表", notes="个人当天数据-查询个人当天数据列表")
    public TableDataInfo list(WxTmpDayWork wxTmpDayWork)
    {
        startPage();
        List<WxTmpDayWork> list = wxTmpDayWorkService.selectWxTmpDayWorkList(wxTmpDayWork);
        return getDataTable(list);
    }

    /**
     * 导出个人当天数据列表
     */
    @PreAuthorize("@ss.hasPermi('dayWork:work:export')")
    @Log(title = "个人当天数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation(value="个人当天数据-导出个人当天数据列表", notes="个人当天数据-导出个人当天数据列表")
    public void export(HttpServletResponse response, WxTmpDayWork wxTmpDayWork)
    {
        List<WxTmpDayWork> list = wxTmpDayWorkService.selectWxTmpDayWorkList(wxTmpDayWork);
        ExcelUtil<WxTmpDayWork> util = new ExcelUtil<WxTmpDayWork>(WxTmpDayWork.class);
        util.exportExcel(response, list, "个人当天数据数据");
    }

    /**
     * 获取个人当天数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('dayWork:work:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation(value="个人当天数据-获取个人当天数据详细信息", notes="个人当天数据-获取个人当天数据详细信息")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(wxTmpDayWorkService.selectWxTmpDayWorkById(id));
    }

    /**
     * 新增个人当天数据
     */
    @PreAuthorize("@ss.hasPermi('dayWork:work:add')")
    @Log(title = "个人当天数据", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation(value="个人当天数据-新增个人当天数据", notes="个人当天数据-新增个人当天数据")
    public AjaxResult add(@RequestBody WxTmpDayWork wxTmpDayWork)
    {
        return toAjax(wxTmpDayWorkService.insertWxTmpDayWork(wxTmpDayWork));
    }

    /**
     * 修改个人当天数据
     */
    @PreAuthorize("@ss.hasPermi('dayWork:work:edit')")
    @Log(title = "个人当天数据", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation(value="个人当天数据-修改个人当天数据", notes="个人当天数据-修改个人当天数据")
    public AjaxResult edit(@RequestBody WxTmpDayWork wxTmpDayWork)
    {
        return toAjax(wxTmpDayWorkService.updateWxTmpDayWork(wxTmpDayWork));
    }

    /**
     * 删除个人当天数据
     */
    @PreAuthorize("@ss.hasPermi('dayWork:work:remove')")
    @Log(title = "个人当天数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
	@ApiOperation(value="个人当天数据-删除个人当天数据", notes="个人当天数据-删除个人当天数据")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(wxTmpDayWorkService.deleteWxTmpDayWorkByIds(ids));
    }
}
